<style >

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}  

/* IMAGE GALLERY */
	.page {
	  padding-top: 16px;
	}
	.page h1 {
	  text-align: center;
	  grid-column: 1/-1;
	  margin: 1rem 0;
	  margin-bottom: 0px;
	  padding: 0.5rem 0;
	  border-top: 3px solid var(--gray);
	  border-bottom: 3px solid var(--gray);
	}

	.gallery-wrapper {
      max-width: 1400px;      /* controls how wide the whole gallery can get */
      margin: 0 auto;        /* centers it */
	  padding-inline: 4vw;
      padding-block: clamp(1rem, 3vh, 10rem);
	}
	
    .image-gallery {
      display: grid;
      grid-template-columns: repeat(4, 1fr);  /* 5 columns on large screens */
      gap: clamp(16px, 2.5vw, 48px);
      list-style: none;
      padding: 0;
      margin: 0;
    }

    .image-gallery li {
      position: relative;
      width: 100%;
      aspect-ratio: 1 / 1;     /* forces a perfect square */
      overflow: hidden;
      border-radius: 14px;
	  border: 3px solid #fff;
      background: #111;
      cursor: pointer;
    }

    .image-gallery li img {
      width: 100%;
      height: 100%;
      object-fit: cover;      /* ArtStation-style crop */
      transition: transform 0.4s ease, filter 0.4s ease;
      display: block;
    }

    .image-gallery li img:hover {
      transform: scale(1.05);
      filter: brightness(1.1);
    }

/* MODALS */

    .modal {
	  display: none;
	  position: fixed;
	  inset: 0;
	  z-index: 10000;
	  background-color: rgba(0, 0, 0, 0.9);
	  flex-direction: column;
	  align-items: center;
	  justify-content: flex-start;
	  padding: 5vh 5vw;
	  
	  overflow-y: auto;
	  overscroll-behavior: contain;
	  -webkit-overflow-scrolling: touch;
	  
	  /* Hide scrollbar in browsers */
	   scrollbar-width: none; /* Firefox */
	   -ms-overflow-style: none;  /* IE 10+ */	
	   
	   /* BLOCK all clicks and touches */
		pointer-events: auto;
		overflow-y: auto; /* allow modal scroll */
	}
	
	.modal::-webkit-scrollbar {
      display: none;  /* Chrome, Safari */
	}
	
	/* Prevent page scrollbar from showing when modal is open */
	body.modal-open {
	  overflow: hidden !important; /* hide the page scrollbar */
	  touch-action: none; /* stops accidental touches */
	  position: fixed;
	  width: 100%;
	}
	
	.modal.show {
	  display: flex;
	}

    .modal-content {
	  max-width: 90vw;
	  max-height: 70vh;
	  object-fit: contain;
	  margin-block: 1rem;
	}

    .modal img {
      max-width: 100%; /* Ensure images don't exceed modal width */
      max-height: 100%; /* Ensure images don't exceed modal height */
    }

    .modal-text p, h3 {
      color: white;
      text-align: center;
	  text-wrap: pretty;
      max-width: 70ch;   /* readable line length */
	  margin-top: 2rem;
	  padding: 0 1rem;
    }
	
	.modal-text p {
		text-align: justify;
	}
	
	/* MODAL BAR — desktop only */
	@media (pointer: fine) {
		#modal-control-bar {
			position: fixed;
			bottom: 30px;
			left: 50%;
			transform: translateX(-50%);
			display: flex;
			gap: 10px;
			background: rgba(0,0,0,0.7);
			padding: 6px 12px;
			border-radius: 12px;
			z-index: 10001;
			align-items: center;
			justify-content: center;
			opacity: 0;
			pointer-events: none; /* Block interactions by default */
			visibility: hidden;   /* Fully hide from browser rendering until needed */
			transition: opacity 0.3s ease;
		}

		#modal-control-bar button {
			width: 40px;
			height: 40px;
			font-size: 1.5rem;
			padding: 0;
			border: 2px solid gray;
			border-radius: 8px;
			background: rgba(0,0,0,1);
			color: white;
			cursor: pointer;
			display: flex;
			align-items: center;
			justify-content: center;
			transition: color 0.2s, border-color 0.2s;
		}

		#modal-control-bar button:hover {
			color: #0df6e8;
			border-color: #0df6e8;
		}
		
		#modal-control-bar.show {
			opacity: 1;
			visibility: visible;
			pointer-events: auto;
			transition: opacity 0.4s ease;
		}
		
		/* When inactive */
		#modal-control-bar.inactive {
		  opacity: 0;
		  pointer-events: none; /* Block interactions by default */
		  visibility: hidden;   /* Fully hide from browser rendering until needed */
		}
	}

	#global-modal-hint {
      position: fixed;
      bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); /* iOS safe area support */
      left: 50%;
      transform: translateX(-50%);
      background: rgba(0,0,0,0.7);
      backdrop-filter: blur(10px);
      color: white;
      padding: 12px 18px;
      border-radius: 14px;
      font-size: 14px;
      text-align: center;
      z-index: 10000;
      pointer-events: none;
	  display: block;     /* always block so animation works */
      opacity: 0;          /* hide it visually */
	}
	
	/* Show hint with JS */
	#global-modal-hint.show {
      display: block;
	  opacity: 1;
	  transform: translateX(-50%) translateY(0);
	  transition: opacity 0.4s ease, transform 0.4s ease;
	}

	#global-modal-hint.hide {
      opacity: 0;
      transform: translateX(-50%) translateY(10px);
	  transition: opacity 0.4s ease, transform 0.4s ease;
	}

	@media (pointer: coarse) {
		#modal-control-bar {
		  display: none;
		}
		.page h1 {
		  margin-block: 0px;
		}
	}

	@media (max-width: 1100px) {
		.image-gallery {
		  grid-template-columns: repeat(3, 1fr);
		}
	}

	@media (max-width: 700px) {
		.image-gallery {
		  grid-template-columns: repeat(2, 1fr);
		}
	}

	@media (max-width: 450px) {
		.image-gallery {
		  grid-template-columns: 1fr;
		}
	}


</style>